home *** CD-ROM | disk | FTP | other *** search
- '********************************************************************
- '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- '* CuteFTP Pro Script Template
- '* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- '*
- '*This default template script is in Visual Basic. You can write
- '*scripts in your language of choice and save it with the proper
- '*extenstion, or use your an editor specific to that language
- '*
- '*
- '*See the help file for more details on how this scripting feature
- '*works. Below is a quick reference of supported commands, followed
- '*by a sample script. You must have Windows Scripting Host installed
- '*for the COM enabled engine to work
- '*
- '*----TEConnection object command reference---
- '*
- '*Public members (Data type followed by the command)
- '*See the help file for a more detailed list
- '*
- '*BSTR Host
- '*BSTR Protocol
- '*Long Port
- '*BSTR Login
- '*BSTR Password
- '*BSTR UseProxy
- '*BSTR TransferType
- '*BSTR LocalFolder
- '*BSTR RemoteFolder
- '*BSTR LocalFilterExclude, LocalFilterInclude
- '*BSTR RemoteFilterExlude, RemoteFilterInclude
- '*Long Retries
- '*Long Delay
- '*BSTR Autorename
- '*BSTR Links
- '*
- '*Public functions - Return Type | Function Name ([argument1],[arguement2])
- '*void Connect ()
- '*void Download (BSTR RemoteName, BSTR LocalName)
- '*void Upload (BSTR LocalName, BSTR RemoteName)
- '*void CreateLocalFolder (BSTR strName)
- '*void CreateRemoteFolder (BSTR strName)
- '*void LocalRemove (BSTR strName)
- '*void RemoteRemove (BSTR strName)
- '*void RemoteRename (BSTR strFrom, BSTR strTo)
- '*void LocalRename (BSTR strFrom, BSTR strTo)
- '*short LocalExist (BSTR strName)
- '*short RemoteExist (BSTR strName)
-
-
- '*****************************************************************
- 'Sample Script in Visual Basic
- 'Sample script using the TEConnection object
- 'Look into c:\temp folder to observe local activity (for testing purposes)
- 'or Right Click on the Transfer Engine icon in the systray and select "show current transfers"
- 'Uses an anonymous login to ftp://kyle.globalscape.net
-
- 'First specify a variable called Mysite
- Dim MySite
-
- 'Creating a connection object and assign it to the variable
- Set MySite = CreateObject("CuteFTPPro.TEConnection")
-
- 'Now set each property for the site connection or use the defaults
- MySite.Protocol = "FTP"
- MySite.Host = "kyle.globalscape.com"
- MySite.Login = "anonymous"
- MySite.Password = "user@user.com"
- MySite.RemoteFolder = "/Pub/cuteftp"
- MySite.UseProxy = "BOTH"
-
-
- 'Now see if the local folder exists
- If (Not (MySite.LocalExists("c:\temp"))) Then
-
- 'Create it if necessary
- MySite.CreateLocalFolder "c:\temp"
-
- 'end of the if/then/else clause
- End If
-
- 'Change directories to the destination folder
- MySite.LocalFolder = "c:\temp"
-
- 'Check if the remote folder exists using another method
- b = MySite.RemoteExists("english")
-
- 'assign the above in to a variable then qualify it
- If (Not b) Then
-
- 'tell the user that the folder was not found and quit since i have no
- ' permission to create the remote folder anyway
- MsgBox "Remote folder not found!. Please make sure that the english folder exists on the remote site"
-
- Quit(1)
- End If
-
- 'Downloading the english folder with all its files into the
- 'local destination folder, giving it a new long name
- MySite.Download "english", "latest english cuteftp version"
-
- MsgBox "Folder english was successfully downloaded to c:\temp\latest english cuteftp version"
-
- 'now we are going to rename the local folder to something shorter
- 'but first check to see if a folder with that name already exist.
- If (MySite.LocalExists("Latest")) Then
- MySite.LocalRemove "Latest"
- MsgBox "Previous version of Latest deleted"
- End If
-
- 'Rename the local folder
- MySite.LocalRename "latest english cuteftp version", "Latest"
-
- MsgBox "Folder renamed to Latest"
-
- 'Done
- 'End of sample script.
- 'You can save you script and then run it by either selecting it from the Tools > Run
- 'Script menu of by double clicking on the script file in Windows
-